<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue 3 组件基础</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
 
</head>
<body>
    <div id="app">
        <hello-world></hello-world>
    </div>

    <script>
        const { createApp, ref } = Vue;

        const HelloWorld = {
            template: `<p>Hello, Vue 3! {{message}}</p>`,
            setup() { 
                const message = ref('Vue 3 with setup function!'); 
                return { message }; 
            }
        };

        createApp({
            components: {
                'hello-world': HelloWorld
            }
        }).mount('#app');
    </script>
</body>
</html>
